package com.szxy.web.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther:zwer
 * @Date:2019/9/2 15:25
 * @Description:com.szxy.web.controller
 * @Version:1.0
 **/
@ControllerAdvice
public class MyExceptionController {

    /**
     * 若出现异常信息，则调用该方法返回响应
     * @return
     */
    @ExceptionHandler(value=java.lang.Exception.class)
    public String myException1(Exception ex){
       /* HashMap<String, Object> map =
                new HashMap<String,Object>();
        map.put("error", "服务器繁忙！！！  =="+ex.getMessage());
        return map;*/
        return "redirect:/error/404"; //显示 404 页面
    }

}
